/*
 * @Author: JohnYang
 * @Date: 2020-09-24 21:13:40
 * @LastEditors: JohnYang
 * @LastEditTime: 2020-09-29 21:44:33
 */
import http from "@/utils/request";
import { compensateType } from "../config";

/**
 * 逗号分隔ID  可支持批量删除
 * @param {String} ids
 * @returns {HttpResponse<Person[]>}
 */
export function deleteCompensate(ids) {
  return http({
    url: "/index/index/delete",
    method: "post",
    data: {
      id: ids,
      type: compensateType
    }
  });
}

/**
 * 保存理赔
 * @param {*} model
 */
export function saveCompensate(model) {
  return http({
    url: "/index/index/save",
    method: "post",
    data: {
      ...model,
      type: compensateType
    }
  });
}

export function getCompensate(id) {
  return http({
    url: "/index/index/detail",
    method: "post",
    data: {
      id,
      type: compensateType
    }
  });
}

export function getCompensateList({
  pageSize,
  pageNum,
  num,
  userName,
  start,
  end,
  brand,
  vehicleModel,
  region,
  qualityProduct,
  dealerName
}) {
  return http({
    url: "/index/index/list",
    method: "post",
    data: {
      type: compensateType,
      pageSize,
      offset: pageNum,
      num,
      userName,
      start,
      end,
      brand,
      vehicleModel,
      region,
      qualityProduct,
      dealerName
    }
  });
}
